package com.xidian.zhiancloud.service.exam.impl;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.xidian.zhiancloud.dao.exam.TTrainContentMapper;
import com.xidian.zhiancloud.model.exam.TrainContent;
import com.xidian.zhiancloud.service.exam.ITrainContentService;

/**
 * 培训内容Service业务层处理
 * 
 * @author zhouweitao
 * @date 2021-03-16
 */
@Service
public class TrainContentServiceImpl implements ITrainContentService 
{
    @Autowired
    private TTrainContentMapper trainContentMapper;

    /**
     * 查询培训内容
     * 
     * @param id 培训内容ID
     * @return 培训内容
     */
    @Override
    public TrainContent selectTrainContentById(Long id)
    {
        return trainContentMapper.selectTrainContentById(id);
    }

    /**
     * 查询培训内容列表
     * 
     * @param trainContent 培训内容
     * @return 培训内容
     */
    @Override
    public Page<TrainContent> selectTrainContentList(TrainContent trainContent)
    {
    	PageHelper.startPage(trainContent.getPageNum()-1, trainContent.getPageSize());
        return trainContentMapper.selectTrainContentList(trainContent);
    }

    /**
     * 新增培训内容
     * 
     * @param trainContent 培训内容
     * @return 结果
     */
    @Override
    public int insertTrainContent(TrainContent trainContent)
    {
        return trainContentMapper.insertTrainContent(trainContent);
    }

    /**
     * 修改培训内容
     * 
     * @param trainContent 培训内容
     * @return 结果
     */
    @Override
    public int updateTrainContent(TrainContent trainContent)
    {
        return trainContentMapper.updateTrainContent(trainContent);
    }

    /**
     * 批量删除培训内容
     * 
     * @param ids 需要删除的培训内容ID
     * @return 结果
     */
    @Override
    public int deleteTrainContentByIds(Long[] ids)
    {
        return trainContentMapper.deleteTrainContentByIds(ids);
    }

    /**
     * 删除培训内容信息
     * 
     * @param id 培训内容ID
     * @return 结果
     */
    @Override
    public int deleteTrainContentById(Long id)
    {
        return trainContentMapper.deleteTrainContentById(id);
    }
}
